<%@ include file="/common/taglibs.jsp" %>

<c:if test="${loanRequest.dealerUser.username==pageContext.request.remoteUser and (loanRequest.phase=='draft' or loanRequest.phase=='dealer_submit')}">
    <c:set var="editCondition" scope="page" value="true" />
</c:if>
<security:authorize ifAnyGranted="ROLE_Bank_CREDIT">
<c:if test="${loanRequest.auditUser.username==pageContext.request.remoteUser and (loanRequest.phase=='bank_credit_audit')}">
<c:set var="editCondition" scope="page" value="false" />
    <c:set var="bankEditCondition" scope="page" value="true" />
</c:if>
    </security:authorize>
<head>
    <title><fmt:message key="loanRequestDetail.title"/></title>
    <meta name="menu" content="LoanRequestListMenu"/>
    <meta name="heading" content="<fmt:message key='loanRequestDetail.heading'/>"/>

</head>

<!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        <fmt:message key="loanRequestDetail.heading"/>
        <small>
            <%@include file="/WEB-INF/pages/loanRequestbasicinfo.jsp"%>
        </small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="/loanRequests"><i class="fa fa-dashboard"></i><fmt:message key="loanRequestList.heading"/></a></li>
        <li class="active"><fmt:message key="loanRequestDetail.heading"/></li>
    </ol>
</section>

<!-- Main content -->
<section class="content">
    <%@ include file="/common/messages.jsp" %>
    <form:errors path="loanRequest.*" cssClass="alert alert-danger alert-dismissable" element="div"/>

    <div class="row">
        <!-- left column -->
        <form:form commandName="loanRequest" method="post" action="loanRequestform" id="loanRequestForm">
            <form:hidden path="id" id="requestId"/>
        <form:hidden  path="number"/>
        <form:hidden path="requestPersonCreditQuestionnaire.id"/>
        <form:hidden path="coPersonCreditQuestionnaire.id"/>
        <form:hidden path="dbPersonCreditQuestionnaire.id"/>
        <form:hidden path="copyFromRequestId"/>
        <div class="col-md-8">
                    <%@include file="/WEB-INF/pages/loanRequestSimpleform.jsp" %>
            <c:if test="${loanRequest.auditUser.username==pageContext.request.remoteUser and loanRequest.phase=='bank_credit_audit'}">

                <%@include file="/WEB-INF/pages/loanrequestBankQuestion.jsp"%>

            </c:if>
            <c:if test="${loanRequest.coLoaned or editCondition}">
                <%@include file="/WEB-INF/pages/loanRequestSimpleformCo.jsp" %>
                <c:if test="${loanRequest.auditUser.username==pageContext.request.remoteUser and loanRequest.phase=='bank_credit_audit'}">

                    <%@include file="/WEB-INF/pages/loanrequestBankQuestionCo.jsp"%>

                </c:if>
</c:if>

            <c:if test="${loanRequest.guaranted or editCondition}">
                <%@include file="/WEB-INF/pages/loanRequestSimpleformDb.jsp" %>
                <c:if test="${loanRequest.auditUser.username==pageContext.request.remoteUser and loanRequest.phase=='bank_credit_audit'}">

                    <%@include file="/WEB-INF/pages/loanrequestBankQuestionDb.jsp"%>

                </c:if>
                    </c:if>

            <%@include file="/WEB-INF/pages/loanRequestSimpleformProduct.jsp" %>
            </div>
                <div class="col-md-4">
                    <%@include file="/WEB-INF/pages/loanrequestactionRender.jsp"%>
                        <%--<c:if test="${loanRequest.status!='draft'}">--%>
                            <%--<%@include file="/WEB-INF/pages/loanRequestfeedback.jsp"%>--%>
                        <%--</c:if>--%>
                </div>
        </div>

        </form:form>
</section>


<c:set var="scripts" scope="request">
    <%@include file="commonJs.jsp"%>
    <script type='text/javascript' src="<c:url value='/dwr/engine.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/util.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/interface/ProvinceManager.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/interface/CityManager.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/interface/VehicleBrandManager.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/interface/VehicleSeriesManager.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/interface/VehicleModelManager.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/interface/LoanProductManager.js'/>"></script>

    <script type="text/javascript" src="<c:url value='/scripts/loanRequestForm.js'/>"></script>
</c:set>